package com.richard.base.ext

import com.richard.base.constants.TimePattern
import java.text.SimpleDateFormat
import java.util.*

/**
 ***************************************
 * 项目名称:Giggle
 * @Author wuzhiguo
 * 邮箱：wuzhiguo@ksjgs.com
 * 创建时间: 2020/7/29     4:40 PM
 * 用途:
 ***************************************
 */

fun Long.timeFormat(pattern : TimePattern) : String {
    val sdf = SimpleDateFormat(pattern.value)
    return sdf.format(Date(this))
}

fun Long.getDay() : Int {
    var calendar = Calendar.getInstance()
    calendar.timeInMillis = this
    return calendar.get(Calendar.DAY_OF_MONTH)
}